package com.qs.controller;

import com.qs.model.dto.OrderDto;
import com.qs.model.vo.OrderInfoVo;
import com.qs.response.Response;
import com.qs.service.ICartService;
import com.qs.service.IPayInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: OrderController
 * Package: com.qs.controller
 * Description:
 *
 * @Author: @weixueshi
 * @Create: 2024/3/30 - 14:32
 * @Version: v1.0
 */
@Slf4j
@Validated
@CrossOrigin
@RestController
@RequestMapping("/pay")
@RequiredArgsConstructor
public class PayController {

    private final IPayInfoService payInfoService;

    /**
     * 支付接口
     * @param orderId
     * @return
     */
    @GetMapping("/{orderId}")
    public Response handlePay(@PathVariable("orderId") String orderId){
        log.info("订单号为{}的订单正在进行支付请求...",orderId);
        payInfoService.handlePay(orderId);
        log.info("订单号为{}的订单支付成功",orderId);
        return Response.success();
    }
}
